﻿using System;
using System.Collections.Generic;
using System.Text;
using T.FAS.Runtime.Base.Entity;
using T.FAS.Runtime.Metadata.Entity.DataModel;

namespace T.FAS.Runtime.DataAccess.SPI
{
    public class CommonModelNodeElement
    {

        #region 属性

        /// <summary>
        /// 标识
        /// </summary>        
        public virtual string ID { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        public virtual string Code { get; set; }

        /// <summary>
        /// 名称
        /// </summary>        
        public virtual string Name { get; set; }

        /// <summary>
        /// 标签
        /// </summary>        
        public virtual string LableID { get; set; }

        /// <summary>
        /// 是否是关联字段
        /// </summary>
        public virtual bool IsAssociated { get; set; }

        /// <summary>
        /// 是否关联带过来的字段
        /// </summary>        
        public virtual bool IsRefElement { get; set; }

        /// <summary>
        /// 数据类型
        /// </summary>        
        public virtual DataType DataType { get; set; }

        /// <summary>
        /// 长度
        /// </summary>       
        public virtual int Length { get; set; }

        /// <summary>
        /// 精度
        /// </summary>        
        public virtual int Precision { get; set; }

        /// <summary>
        /// 默认值
        /// </summary>        
        public virtual string DefaultValue { get; set; }

        /// <summary>
        /// 所属的节点对象
        /// </summary>            
        public virtual CommonModelNode Node { get; set; }

        /// <summary>
        /// 所属的节点对象ID
        /// </summary>            
        public virtual string NodeID
        {
            get
            {
                return Node.ID;
            }
        }

        /// <summary>
        /// 是否国际化
        /// </summary>        
        public virtual bool IsMulitLang { get; set; }

        /// <summary>
        /// 是否枚举类型
        /// </summary>
        public virtual bool IsEnum { get; set; }

        /// <summary>
        /// 包含的枚举列表
        /// </summary>
        private EnumValueCollection enumValueCollection;

        /// <summary>
        /// 包含的枚举列表
        /// </summary>
        public EnumValueCollection ContainEnumValues
        {
            get
            {
                if (enumValueCollection == null)
                    enumValueCollection = new EnumValueCollection();
                return enumValueCollection;
            }
            set
            {
                enumValueCollection = value;
            }
        }

        /// <summary>
        /// 节点元素类型
        /// </summary>
        /// <remarks>关联？枚举？无</remarks>
        public ElementType ElementType { get; set; }

        /// <summary>
        /// 是否虚拟元素
        /// </summary>
        public bool IsVirtualElement { get; set; }

        /// <summary>
        /// 虚拟元素的表达式
        /// </summary>
        public string CustomExpression { get; set; }

        /// <summary>
        /// 引用的元素ID
        /// </summary>
        public string RefElementID { get; set; }

        #endregion
    }
}
